package cn.jsu.oj.judgment.handle;

import cn.jsu.oj.judgment.utils.NetUtil;
import io.netty.channel.Channel;


/**
 * @author ahtonc
 */
public class CommandPack<T> {
    private String identity;
    private T data;

    public CommandPack() {
    }

    public CommandPack(String ip, T data) {
        this.identity = ip;
        this.data = data;
    }

    public CommandPack(Channel channel, T data) {
        this.identity = NetUtil.getIdentify(channel);
        this.data = data;
    }


    public String getIdentity() {
        return identity;
    }

    public void setIdentity(String identity) {
        this.identity = identity;
    }


    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "CommandPack{" +
                "ip='" + identity + '\'' +
                ", data=" + data +
                '}';
    }
}
